public class Homework7 {
    public static void main(String[] args) {
        // 定义需要转换的数值
        String binaryNumber = "0b10100101";
        String octalNumber = "0345";
        String hexadecimalNumber = "0xef";

        // 使用 parseInt 方法将字符串转换为十进制数
        int decimalFromBinary = Integer.parseInt
                (binaryNumber.substring(2), 2);
        int decimalFromOctal = Integer.parseInt(octalNumber, 8);
        int decimalFromHexadecimal = Integer.parseInt
                (hexadecimalNumber.substring(2),16);

        // 输出结果
        System.out.println("Binary to Decimal: " + decimalFromBinary);
        System.out.println("Octal to Decimal: " + decimalFromOctal);
        System.out.println("Hexadecimal to Decimal: " + decimalFromHexadecimal);
    }
}

